package utilities;

import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;

public class FileComparator {
	private File first;
	private File second;
	
	public FileComparator(File first, File second) {
		this.first = first;
		this.second = second;
	}
	
	public void compare () {
		try {
			FileInputStream fisf = new FileInputStream(first);
			FileInputStream fiss = new FileInputStream(second);
			
			int bf = 0;
			int bs = 0;
			int i=0;
			while (bf != -1){
				bf = fisf.read();
				bs = fiss.read();
				if (bf != bs){
					System.out.println("pliki roznia sie na pozycji "+i);
				}
				i++;
			}
			if (bf != bs){
				System.out.println("pliki roznia sie na ostatniej pozycji "+i);
			}
			fisf.close();
			fiss.close();
		} catch (IOException e){
			System.out.println("Nie da sie porownac pikow");
		}
	}
}
